package com.study.mybatisplus.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.mybatisplus.entity.User;
import com.study.mybatisplus.mapper.UserMapper;
import com.study.mybatisplus.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户 服务实现类
 * </p>
 *
 * @author yuanZhi
 * @since 2020-05-15
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
		implements UserService {

	@Autowired
	private UserMapper userMapper;

	@Override
	public List<User> getAllByType() {
		/*return userMapper.getAllByType(
				Wrappers.<User> lambdaQuery().eq(User::getType, 1));*/
		return userMapper.getAll(
				Wrappers.<User> lambdaQuery().eq(User::getType, 1));
	}

	@Override
	public IPage<User> getPage(Page user) {
		return userMapper.getPage(user);
	}
}
